

import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const Home = () => import("../views/home/home");
const categorypage = () => import("../views/categorypage/categorypage.vue");
const login = () => import("../views/user/login.vue");
const user =() =>import("../views/user/user.vue")
const shopcart=() =>import("../views/shopcart/shopcart.vue")
const goods=()=>import('../views/goods/good.vue')
const goodsDetail=()=>import('../views/goods/goodsDetail.vue')



const routes = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    component: Home,
    meta: {
      index: 1,
    },
  },
  {
    path: "/categorypage",
    component: categorypage,
    meta: {
      index: 2,
    },
  },
  {
    path: "/login",
    component: login,
    meta: {
      index: 2,
    },
  },
  {
    path: "/user",
    component: user,
    meta: {
      index: 2,
    },
  },
  {
    path: "/shopcart",
    component: shopcart,
    meta: {
      index: 2,
    },
  },
  {
    path: "/goods/:id",
    component: goods,
    meta: {
      index: 2,
    },
  },
  {
    path: "/goodsDetail/:id",
    component: goodsDetail,
    meta: {
      index: 3,
    },
  },
];

const router = new VueRouter({
  routes,
});
export default router;
